<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 借用构造函数继承
        // 实现：复制父类的实例给子类，
        // 缺点：只能继承父类的实例属性和方法，不能继承原型属性/方法
        function Father() {
            this.colors = ['red', 'blue']
        }
        Father.prototype.getColors = function () {
            console.log(this)
            return this.colors
        }
        function Son() {
            Father.call(this)
        }
        var instance = new Son()
        instance.colors.push('white')
        console.log(instance);
        var instance2 = new Son()
        instance2.colors.push('black')
        console.log(instance2);
    </script>
</body>

</html>